package com.oracle.lingshangejia.activity;

import android.app.DatePickerDialog;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.ExpandableListView;
import android.widget.ImageButton;
import android.widget.RadioButton;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;

import com.google.gson.Gson;
import com.lws.basic.utils.common.MyToast;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;
import com.oracle.lingshangejia.Constant;
import com.oracle.lingshangejia.R;
import com.oracle.lingshangejia.adapter.HealthCheckExtendableListAdapter;
import com.oracle.lingshangejia.base.BaseActivity;
import com.oracle.lingshangejia.bean.DataBean;
import com.oracle.lingshangejia.utils.MyLogger;
import com.oracle.lingshangejia.utils.SpUtils;
import com.oracle.lingshangejia.utils.TimeUtils;

import org.json.JSONObject;

import java.util.Arrays;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
//体检
public class HealthCheckArchivesActivity extends BaseActivity {
    private ExpandableListView expandableListView;
    private HealthCheckExtendableListAdapter archivesExtendableListAdapter;
    private TextView tv_title;
    private ImageButton ib_back;
    private int jmid;
    private String tjbh;
    Map<Object,Object> values = new HashMap<>();
    /**
     * Activity销毁时清空SQLite中数据
     */
    @Override
    protected void onDestroy() {
        super.onDestroy();
        //sqLiteHelper.deleteAll();
    }

    @Override
    public int intiLayout() {
        return R.layout.add_health_main;
    }

    @Override
    public void initView() {
      //  tjbh=getIntent().getStringExtra("tjbh");
        jmid=getIntent().getIntExtra("jmid",0);
        MyLogger.i("体检编号"+tjbh+"    居民id"+jmid);
        tv_title=findViewById(R.id.tv_title);
        ib_back=findViewById(R.id.ib_back);
        ib_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        tv_title.setText("健康体检表");
        expandableListView = findViewById(R.id.expandableListView);
        String[] archivesStr = getResources().getStringArray(R.array.health_archives);
        archivesExtendableListAdapter = new HealthCheckExtendableListAdapter(archivesStr);
        expandableListView.setAdapter(archivesExtendableListAdapter);
        // 添加末尾提交按钮
        View foot = LayoutInflater.from(this).inflate(R.layout.health_foot_submit, null);
        expandableListView.addFooterView(foot);

        expandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
            @Override
            public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
                return false;
            }
        });

        expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
            @Override
            public void onGroupExpand(int groupPosition) {
                int count = expandableListView.getExpandableListAdapter().getGroupCount();
                for (int i = 0; i < count; i++) {
                    if (i != groupPosition) {
                        expandableListView.collapseGroup(i);
                    }
                }
            }
        });
        expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
            @Override
            public void onGroupCollapse(int groupPosition) {
                View[] views = ((HealthCheckExtendableListAdapter) expandableListView.getExpandableListAdapter()).getConvertViews();
                View view = views[groupPosition];
                if (view == null) {
                    return;
                }

                switch (groupPosition) {
                    case 0:  //个人信息及症状
                        MyLogger.i("0 个人信息");
                        getBasicInfoValues();
                        break;
                    case 1:  //一般情况1
                        MyLogger.i("一般情况1");
                        getEducationAndProfessionalAndMarriageAndPayValues(view);
                        break;
                    case 2:  //一般情况2
                        getAllergyAndExposedValues(view);
                        break;
                    case 3://生活方式1
                         getSurgeryAndTraumaAndTransfusionValues(view);
                        break;
                    case 4://6 生活方式2
                        try {
                            getGeneticDiseaseAndDisabilityAndEnvironmentValues(view);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        break;
                    case 5: //生活方式3

                        healthyNewborn(view);
                        break;
                    case 6:
                        JSONObject jsonObject = new JSONObject(physicalExaminationOfNewbornSurgery(view));
                        MyLogger.i(jsonObject.toString());
                        break;
                    case 7:
                        adviceAndGuidance(view);
                        break;
                    case 8://11
                         getFamilialDiseaseFatherValues(view);
                        break;
                    case 9://13
                        getFamilialDiseaseBrotherValues(view);
                        break;
                    case 10://13
                        getFamilialDiseaseBrotherValues_1(view);
                        break;
                    case 11://13
                        getFamilialDiseaseBrotherValues_2(view);
                        break;
                    case 12://13
                         getFamilialDiseaseBrotherValues_3(view);
                        break;
                    case 13://13
                        getFamilialDiseaseBrotherValues_4(view);
                        break;
                    case 14:
                        examineOne(view);
                        break;
                    case 15:
                        examineTwo(view);
                        break;
                    case 16:
                         examineThree(view);
                        break;
                    case 17:
                        healthProblemOne(view);
                        break;
                    case 18:
                         healthProblemTwo(view);
                        break;
                    case 19:
                        healthProblemThree(view);
                        break;
                    case 20:
                        hospitalization(view);
                        break;
                    case 21:
                        medicationOne(view);
                        break;
                    case 22:
                        medicationTwo(view);
                        break;
                    case 23:
                        prophylacticVaccination(view);
                        break;
                    case 24:
                        EvaluationAndGuidance(view);
                        break;
                    case 25:
                        RiskFactorControl(view);
                        break;


                }
             /*   System.out.println("存在的数据条数：" + sqLiteHelper.queryAll().getCount());
                if (values != null && values.size() > 0)
                    saveValues(values);*/
           }
        });
//
//        expandableListView.expandGroup(0);
   //       sqLiteHelper = new HealthCheckSQLiteHelper(this);
//        sqLiteHelper.deleteAll();
    }
//    /**
//     * 检查用户名、身份证号和本人联系电话是否正确填写
//     *
//     * @return 数据不正确返回true，正确返回false
//     */
//    private boolean checkBasicInfoIsError() {
//        Map<Object, Object> basicInforValues = getBasicInfoValues();
//        int xm = basicInforValues.get(jmid);
//        // 姓名非空验证
//        if (xm == null || xm.length() == 0) {
//            Toast.makeText(getApplicationContext(), "姓名必须填写", Toast.LENGTH_SHORT).show();
//            return true;
//        }
//
//        return false;
//    }

    @Override
    public void initData() {
        values.put("tjrq", TimeUtils.getTodayDate("yyyy-MM-dd"));
        //sqLiteHelper = new HealthCheckSQLiteHelper(this);
    }



    /**
     * 获取基本信息数据  姓名及症状
     * 第一页
     */
    private void getBasicInfoValues() {

        View[] views = ((HealthCheckExtendableListAdapter) expandableListView.getExpandableListAdapter()).getConvertViews();
        View view = views[0];
        /*
         * 第一页，基本信息1
         */
        // 姓名
        String health_username = "";
        // 体检日期
        String follow_up_date = "";
        // 责任医生
        String health_doctor = "";

        health_username = ((EditText) view.findViewById(R.id.health_username)).getText().toString().trim();
        follow_up_date = ((TextView) view.findViewById(R.id.postpartum_42_health_examination_follow_up_date)).getText().toString().trim();
        //health_doctor = ((EditText) view.findViewById(R.id.health_doctor)).getText().toString().trim();
        values.put("tjrq", follow_up_date);
        // values.put("zrys", health_doctor);
        /*
         * 基本信息
         */
        String health_symptom_1 = "";
        String health_symptom_25 = ((EditText) view.findViewById(R.id.health_symptom_25_text)).getText().toString().trim();
        if (view != null) {
            View[] PastHistoryFatherViews= getViews(view.findViewById(R.id.health_symptom));
            for (int i = 0; i < PastHistoryFatherViews.length; i++) {
                if (PastHistoryFatherViews[i] instanceof CheckBox) {
                    CheckBox cb = (CheckBox) PastHistoryFatherViews[i];
                    if (cb.isChecked()) {
                        String s = cb.getText().toString().trim();
                        s = s.substring(0, s.indexOf(" "));
                        health_symptom_1 += s;
                        health_symptom_1+= ",";

                    }
                }
            }
            if (health_symptom_1.length() != 0) {
                health_symptom_1 = health_symptom_1.substring(0, health_symptom_1.length() - 1);
            }
        }
        values.put("zz", health_symptom_1);
        values.put("zzQt", health_symptom_25);
        JSONObject jsonObject = new JSONObject(values);
        MyLogger.i(jsonObject.toString());

    }

    /**
     * 一般情况 --到体质指数
     * 第二页
     */
    private void getEducationAndProfessionalAndMarriageAndPayValues(View view) {
        /*
         * 第一页，一般情况1
         */
        // 体温
        String health_temperature = "0.0";
        //脉搏
        String health_pulse = "0.0";
        //呼吸频率
        String health_breathing = "0.0";
        //血压左侧
        String health_pressure_left = "0.0";
        //血压右侧
        String health_pressure_right = "0.0";
        //身高
        String health_height = "0.0";
        //体重
        String health_weight = "0.0";
        //腰围
        String health_waistline = "0.0";

        String health_bmi = "0.0";

        health_temperature = ((EditText) view.findViewById(R.id.health_temperature)).getText().toString().trim();
        health_pulse = ((EditText) view.findViewById(R.id.health_pulse)).getText().toString().trim();
        health_breathing = ((EditText) view.findViewById(R.id.health_breathing)).getText().toString().trim();
        health_pressure_left = ((EditText) view.findViewById(R.id.health_pressure_left)).getText().toString().trim();
        health_pressure_right = ((EditText) view.findViewById(R.id.health_pressure_right)).getText().toString().trim();
        health_height = ((EditText) view.findViewById(R.id.health_height)).getText().toString().trim();
        health_weight = ((EditText) view.findViewById(R.id.health_weight)).getText().toString().trim();
        health_waistline = ((EditText) view.findViewById(R.id.health_waistline)).getText().toString().trim();
        health_bmi = ((EditText) view.findViewById(R.id.health_bmi)).getText().toString().trim();
        if (!TextUtils.isEmpty(health_temperature))
           values.put("tw", Double.valueOf(health_temperature));
        if (!TextUtils.isEmpty(health_breathing))
            values.put("hxpl", Double.valueOf(health_breathing));
        if (!TextUtils.isEmpty(health_pressure_left))
            values.put("zcxy", Double.valueOf(health_pressure_left));
        if (!TextUtils.isEmpty(health_pressure_right))
            values.put("ycxy ",Double.valueOf(health_pressure_right));
        if (!TextUtils.isEmpty(health_height))
            values.put("sg", Double.valueOf(health_height));
        if (!TextUtils.isEmpty(health_weight))
            values.put("tz", Double.valueOf(health_weight));
        if (!TextUtils.isEmpty(health_waistline))
            values.put("yw", Double.valueOf(health_waistline));
        if (!TextUtils.isEmpty(health_bmi))
            values.put("tzzs", Double.valueOf(health_bmi));	//体质指数
        MyLogger.i((new JSONObject(values).toString()));



    }

    /**
     * 一般状况2
     * 第三页
     */
    private void getAllergyAndExposedValues(View view) {
        //老年人健康状态自我评估
        String health_oldhealth_1 = " ";
        View[] exposedViews_1 = getViews(view.findViewById(R.id.rg_radiogroup111));
        for (int i = 0; i < exposedViews_1.length; i++) {
            if (exposedViews_1[i] instanceof RadioButton) {
                RadioButton cb = (RadioButton) exposedViews_1[i];
                if (cb.isChecked()) {
                    String s = cb.getText().toString().trim();
                    s = s.substring(0, s.indexOf(" "));
                    health_oldhealth_1 =s;
                }
            }
        }

        values.put("jkztzwpg",health_oldhealth_1);//老年人健康状态自我评估
        //老年人生活自理能力自我评估
        String health_life_1 = "";
        View[] exposedViews_2 = getViews(view.findViewById(R.id.radiogroup222));
        for (int i = 0; i < exposedViews_2.length; i++) {
            if (exposedViews_2[i] instanceof RadioButton) {
                RadioButton cb = (RadioButton) exposedViews_2[i];
                if (cb.isChecked()) {
                    String s = cb.getText().toString().trim();
                    s = s.substring(0, s.indexOf(" "));
                    health_life_1 =s;

//
                }
            }
        }
//        if (health_life_1.length() != 0) {
//            health_life_1= health_life_1.substring(0, health_life_1.length() - 1);
//        }

         values.put("zlnlzwpg",health_life_1);
         /*
            第四页 老年人认知功能
         */
        // 老年人认知功能
        int health_cognition_1 = 0;
        // 老年人情感状态
        int health_emotion_1 = 0;

        if (((RadioButton) view .findViewById(R.id.health_cognition_1)).isChecked()) {
            //老年人认知功能 = "1 无";
            health_cognition_1 = 1;
        } else {
           // health_cognition_1= ((EditText) view.findViewById(R.id.health_cognition_name)).getText().toString().trim();
            health_cognition_1 = 2;
        }
        if (((RadioButton) view .findViewById(R.id.health_emotion_1)).isChecked()) {
            //老年人情感状态= "1 无";
            health_emotion_1 = 1;
        } else {
           // health_emotion_1= ((EditText) view.findViewById(R.id.health_emotion_name)).getText().toString().trim();
            health_emotion_1= 2;
        }
       // health_cognition_name
        String rzgnPf ="";
        String qgzkPf ="";
        rzgnPf = ((EditText) view.findViewById(R.id.health_cognition_name)).getText().toString().trim();
        qgzkPf = ((EditText) view.findViewById(R.id.health_emotion_name)).getText().toString().trim();
        values.put("rzgn", health_cognition_1+"");
        values.put("qgzk", health_emotion_1+"");
        values.put("rzgnPf",rzgnPf);//老年人认知评分
        values.put("qgzkPf",qgzkPf);//老年人情感评分
        JSONObject jsonObject = new JSONObject(values);
        MyLogger.i(jsonObject.toString());

    }
    /**
     * 第五页 生活方式2
     */
    private void getSurgeryAndTraumaAndTransfusionValues(View view) {
        //锻炼频率
        String health_gender = "0";
        // 每次锻炼时间
        String health_exercise_time = "0";
        // 坚持锻炼时间
        String health_exercise_insistime= "0";
        // 锻炼方式
        String health_exercise_mode = "";
        // 饮食喜欢
        String health_diet= "";
        // 吸烟状况
        String health_smoke_situation = "0";
        //日吸烟量
        String health_smoke_volume = "0";
        // 开始吸烟年龄
        String health_smoke_start = "0";
        //戒烟年龄
        String health_smoke_quit = "0";

        health_gender= ((Spinner) view.findViewById(R.id.health_gender)).getSelectedItem().toString().trim();
        health_exercise_time = ((EditText) view.findViewById(R.id.health_exercise_time)).getText().toString().trim();
        health_exercise_insistime = ((EditText) view.findViewById(R.id.health_exercise_insistime)).getText().toString().trim();
        health_exercise_mode = ((EditText) view.findViewById(R.id.health_exercise_mode)).getText().toString().trim();
        health_diet = ((Spinner) view.findViewById(R.id.health_diet)).getSelectedItem().toString().trim();
        health_smoke_situation = ((Spinner) view.findViewById(R.id.health_smoke_situation)).getSelectedItem().toString().trim();
        health_smoke_volume = ((EditText) view.findViewById(R.id.health_smoke_volume)).getText().toString().trim();
        health_smoke_quit = ((EditText) view.findViewById(R.id.health_smoke_quit)).getText().toString().trim();
        health_diet=health_diet.substring(0, health_diet.indexOf(" "));//饮食习惯
        if (health_gender.contains("每天")) {
            values.put("dlpl", 1 + "");
        }  if (health_gender.contains("每周一次以上")) {
            values.put("dlpl", 2 + "");
        }  if (health_gender.contains("偶尔")) {
            values.put("dlpl", 3 + "");
        } if ((health_gender.contains("不锻炼"))){
            values.put("dlpl", 4 + "");
        }
        values.put("mcdlsj", health_exercise_time);
        values.put("jcdlsj", health_exercise_insistime);
        values.put("dlfs", health_exercise_mode + "");
        values.put("ysxg", health_diet);
        if (health_smoke_situation.contains("从不吸烟")) {
            values.put("xyzk", 1 + "");
        } else if (health_smoke_situation.contains("以戒烟")) {
            values.put("xyzk", 2 + "");
        } else {
            values.put("xyzk", 3 + "");
        }
        values.put("rxyl", health_smoke_volume);
        values.put("ksxynl", health_smoke_start);
        values.put("jynl", health_smoke_quit);
        JSONObject jsonObject = new JSONObject(values);
        MyLogger.i(jsonObject.toString());

    }



    /*
     * 第6页，生活方式3
     */
    private void getGeneticDiseaseAndDisabilityAndEnvironmentValues(View view) throws Exception{

        //饮酒频率
        String health_alcohol_frequency = "";
        // 日饮酒量
        String health_alcohol_volume = "";

        health_alcohol_frequency= ((Spinner) view.findViewById(R.id.health_alcohol_frequency)).getSelectedItem().toString().trim();
        health_alcohol_volume = ((EditText) view.findViewById(R.id.health_alcohol_volume)).getText().toString().trim();
        health_alcohol_frequency = health_alcohol_frequency.substring(0, health_alcohol_frequency.indexOf(" "));
        values.put("yjpl", health_alcohol_frequency);
        values.put("ryjl", health_alcohol_volume);

        // 是否戒酒
        String health_alcohol_quit_yes = "1";
        if (((RadioButton) view .findViewById(R.id.health_alcohol_quit_yes)).isChecked()) {
            //老年人认知功能 = "1 无";
            health_alcohol_quit_yes = "1";
        } else {
           // health_alcohol_quit_yes= ((EditText) view.findViewById(R.id.health_alcohol_quit_age)).getText().toString().trim();
            health_alcohol_quit_yes = "2";
        }
        String jjnl = "";
                jjnl = ((EditText) view.findViewById(R.id.health_alcohol_quit_age)).getText().toString().trim();
        values.put("sfjj",health_alcohol_quit_yes);
        values.put("jjnl", jjnl);

        //开始饮酒年龄
        String health_alcohol_start = "";
        health_alcohol_start= ((EditText) view.findViewById(R.id.health_alcohol_start)).getText().toString().trim();
        values.put("ksyjnl", health_alcohol_start);

        //近一年内是否曾醉酒

         String health_alcohol_yes = "1";
         RadioButton radioButton = view.findViewById(R.id.health_alcohol_yes);
         if (radioButton.isChecked()){
             health_alcohol_yes= "1";
         }else {
             health_alcohol_yes= "2";
         }

        values.put("jynsfyj", health_alcohol_yes);

        String health_alcohol_type_1 = "";
        String health_alcohol_type_5 =((EditText) view.findViewById(R.id.health_alcohol_type_other_name)).getText().toString().trim();;
        if (view != null) {
            View[] PastHistoryFatherViews= getViews(view.findViewById(R.id.health_symptom));
            for (int i = 0; i < PastHistoryFatherViews.length; i++) {
                if (PastHistoryFatherViews[i] instanceof CheckBox) {
                    CheckBox cb = (CheckBox) PastHistoryFatherViews[i];
                    if (cb.isChecked()) {
                        String s = cb.getText().toString().trim();
                        s = s.substring(0, s.indexOf(" "));
                        health_alcohol_type_1 += s;
                        health_alcohol_type_1 += ",";

                    }
                }
            }
            if (health_alcohol_type_1.length() != 0) {
                health_alcohol_type_1 = health_alcohol_type_1.substring(0, health_alcohol_type_1.length() - 1);
            }

        }
        values.put("yjzl", health_alcohol_type_1);//饮酒种类
        values.put("yjzlQt", health_alcohol_type_5);//饮酒种类其他
        JSONObject jsonObject = new JSONObject(values);
        MyLogger.i("生活方式2"+jsonObject.toString());
    }
    /*
     * 第7页，生活方式4
     */
    private void healthyNewborn(View view) {
        //职业病危害因素接触史
        String health_occupational_disease_no = "";

        RadioButton radioButton = view.findViewById(R.id.health_occupational_disease_no );
        if (radioButton.isChecked()){
            health_occupational_disease_no="1";
        }else {
            health_occupational_disease_no ="2";
        }
        values.put("zybwh", health_occupational_disease_no);//   //职业病危害因素接触史

        //工种
        String health_occupational_disease_name = "";
        //从业时间
        String health_occupational_disease_year = "";
        //粉尘
        String health_ccupational_disease_name_1 = "";
        health_occupational_disease_name= ((EditText) view.findViewById(R.id.health_occupational_disease_name)).getText().toString().trim();
        health_occupational_disease_year= ((EditText) view.findViewById(R.id.health_occupational_disease_year)).getText().toString().trim();
        health_ccupational_disease_name_1= ((EditText) view.findViewById(R.id.health_ccupational_disease_name_1)).getText().toString().trim();
        values.put("zybwhGz", health_occupational_disease_name);
        values.put("zybwhN", health_occupational_disease_year);
        values.put("dwzlFc", health_ccupational_disease_name_1);

        //放射物质
        String health_ccupational_disease_name_2 = "";
        //物理因素
        String health_ccupational_disease_name_3 = "";
        //化学物质
        String health_ccupational_disease_name_4 = "";
        //其他
        String health_ccupational_disease_name_other= "";
        health_ccupational_disease_name_2= ((EditText) view.findViewById(R.id.health_ccupational_disease_name_2)).getText().toString().trim();
        health_ccupational_disease_name_3= ((EditText) view.findViewById(R.id.health_ccupational_disease_name_3)).getText().toString().trim();
        health_ccupational_disease_name_4= ((EditText) view.findViewById(R.id.health_ccupational_disease_name_4)).getText().toString().trim();
        health_ccupational_disease_name_other= ((EditText) view.findViewById(R.id.health_ccupational_disease_name_other)).getText().toString().trim();
        values.put("dwzlFswz", health_ccupational_disease_name_2);
        values.put("dwzlWlys", health_ccupational_disease_name_3);
        values.put("hxwzFhcsms", health_ccupational_disease_name_4);
        values.put("dwzlQt", health_ccupational_disease_name_other);

        //粉尘防护
        String health_protective_measures_yes_1 = "";
        RadioButton radioButton1 = view.findViewById(R.id. health_protective_measures_yes_1);
        if (radioButton1.isChecked()){
            health_protective_measures_yes_1="1";
        }else {
            health_protective_measures_yes_1 ="2";
        }
        values.put("fcFhcs", health_protective_measures_yes_1);

        //放射物质防护
        String health_protective_measures_yes_2 = "";
        if (((RadioButton)view.findViewById(R.id.health_protective_measures_yes_2)).isChecked()){
            health_protective_measures_yes_2 ="1";
        }else {
            health_protective_measures_yes_2 ="2";
        }

        values.put("fswzFhcsms", health_protective_measures_yes_2);
        //物理因素防护
        String health_protective_measures_yes_3 = "";
        if (((RadioButton)view.findViewById(R.id.health_protective_measures_yes_3)).isChecked()){
            health_protective_measures_yes_3 ="1";
        }else {
            health_protective_measures_yes_3 ="2";
        }

        values.put("wlysFhcs", health_protective_measures_yes_3);
        //化学物质防护
        String health_protective_measures_yes_4 = "";
        if (((RadioButton)view.findViewById(R.id.health_protective_measures_yes_4)).isChecked()){
            health_protective_measures_yes_4 ="1";
        }else {
            health_protective_measures_yes_4 ="2";
        }
        values.put("hxwzFhcs", health_protective_measures_yes_4);
        //其他物质防护
        String health_protective_measures_yes_5 = "";
        if (((RadioButton)view.findViewById(R.id.health_protective_measures_yes_5)).isChecked()){
            health_protective_measures_yes_5 ="1";
        }else {
            health_protective_measures_yes_5 ="2";
        }
        values.put("qtFhcs", health_protective_measures_yes_5);
        JSONObject jsonObject = new JSONObject(values);
        MyLogger.i("生活方式3"+jsonObject.toString());

    };
    /*
     * 第8页，生活方式4
     */
    private Map<String, String> physicalExaminationOfNewbornSurgery(View view) {
        Map<String, String> params = new HashMap<>();
        //口唇
        String health_gender = "";
        // 咽部
        String health_pharyngeal = "";

        health_gender= ((Spinner) view.findViewById(R.id.health_gender)).getSelectedItem().toString().trim();
        health_pharyngeal = ((Spinner) view.findViewById(R.id.health_pharyngeal)).getSelectedItem().toString().trim();
        health_gender = health_gender.substring(0,health_gender.indexOf(" ") );
        health_pharyngeal = health_pharyngeal.substring(0, health_pharyngeal.indexOf(" "));
        params.put("kc", health_gender);
        params.put("yb", health_pharyngeal);//咽部
        /*
         * 齿列
         */
        String health_Tooth_crack_normal = "";
        if (view != null) {
            View[] PastHistoryFatherViews= getViews(view.findViewById(R.id.health_organ_function));
            for (int i = 0; i < PastHistoryFatherViews.length; i++) {
                if (PastHistoryFatherViews[i] instanceof CheckBox) {
                    CheckBox cb = (CheckBox) PastHistoryFatherViews[i];
                    if (cb.isChecked()) {
                        String s = cb.getText().toString().trim();
                        s = s.substring(0, s.indexOf(" "));
                        health_Tooth_crack_normal += s;
                        health_Tooth_crack_normal+= ",";
                    }
                }
            }
            if (health_Tooth_crack_normal.length() != 0) {
                health_Tooth_crack_normal = health_Tooth_crack_normal.substring(0, health_Tooth_crack_normal.length() - 1);
            }

        }
        params.put("cl", health_Tooth_crack_normal);

        //视力左眼
        String health_vision_zuo = "";
        // 视力右眼
        String health_vision_you = "";

        health_vision_zuo= ((EditText) view.findViewById(R.id.health_vision_zuo)).getText().toString().trim();
        health_vision_you = ((EditText) view.findViewById(R.id.health_vision_you)).getText().toString().trim();

        /*params.put("slZydouble", health_vision_zuo);
        params.put("slYydouble", health_vision_you);*/
        params.put("slZy", health_vision_zuo);
        params.put("slYy", health_vision_you);
        //口唇
        String health_Vision_correction_zuo = "";
        // 咽部
        String health_Vision_correction_you = "";

        health_Vision_correction_zuo= ((EditText) view.findViewById(R.id.health_Vision_correction_zuo)).getText().toString().trim();
        health_Vision_correction_you = ((EditText) view.findViewById(R.id.health_Vision_correction_you)).getText().toString().trim();

        params.put("jzslZy", health_Vision_correction_zuo);
        params.put("jzslYy", health_Vision_correction_you);

        //听力
        String health_hearing_ok = "";
       // health_hearing_ok
        if (((RadioButton)view.findViewById(R.id.health_hearing_ok)).isChecked()) {
        health_hearing_ok = "1";
        }else {
            health_hearing_ok = "2";
        }
        params.put("tl", health_hearing_ok);

        //运动功能
        String health_Motor_function = "";
        if (((RadioButton)view.findViewById(R.id.health_hearing_ok)).isChecked()) {
            health_Motor_function = "1";
        }else {
            health_Motor_function = "2";
        }

        params.put("ydgn", health_Motor_function);
        values.putAll(params);
        JSONObject jsonObject = new JSONObject(params);
        MyLogger.i(jsonObject.toString());
        return params;
    };

    private Map<String, String> adviceAndGuidance(View view) {
        Map<String, String> params = new HashMap<>();

        // 眼底
        String health_fundus_normal = "";
        // 皮肤
        String health_The_skin_normal = "";
        String health_The_skin_other_text = "";
        if (view != null) {
            if (((RadioButton) view.findViewById( R.id.health_fundus_normal )).isChecked()) {
                //national = "1 汉族";
                health_fundus_normal= "1";
            } else {
                //national = ((EditText) views[0].findViewById(R.id.archives_national_other)).getText().toString().trim();
                health_fundus_normal = "2";
               // health_fundus_normal = ((EditText) view.findViewById( R.id.health_fundus_other )).getText().toString().trim();
            }
        }
        String ydyc = "";
        ydyc= ((EditText) view.findViewById( R.id.health_fundus_other)).getText().toString();
        String health_Lymph_node_ok = "";
        View[] exposedViews1 = getViews(view.findViewById(R.id.cha_ti_3_pf));
        for (int i = 0; i < exposedViews1.length; i++) {
            if (exposedViews1[i] instanceof RadioButton) {
                RadioButton cb = (RadioButton) exposedViews1[i];
                if (cb.isChecked()) {
                    String s = cb.getText().toString().trim();
                    MyLogger.i(s);
                    health_The_skin_normal  = s.substring(0, s.indexOf(" "));
                }
            }
        }
        String pfqt = "";
        pfqt= ((EditText) view.findViewById( R.id.health_The_skin_other_text)).getText().toString();
        params.put("ydyc",ydyc);
        params.put("pfqt", pfqt);
        params.put( "yd", health_fundus_normal );
        params.put( "pf", health_The_skin_normal );

        values.putAll(params);
        JSONObject jsonObject = new JSONObject(params);
        MyLogger.i(jsonObject.toString());

        return params;
    };
    /*
     * 第十页，查体2
     */
    //
    private Map<String, String> getFamilialDiseaseFatherValues(View view) {
        Map<String, String> params = new HashMap<>();
        //虹膜
        String health_sclera_ok = "";
        View[] exposedViews = getViews(view.findViewById(R.id.cha_ti_2_gm));
        for (int i = 0; i < exposedViews.length; i++) {
            if (exposedViews[i] instanceof RadioButton) {
               RadioButton cb = (RadioButton) exposedViews[i];
                if (cb.isChecked()) {
                    String s = cb.getText().toString().trim();
                    health_sclera_ok = s.substring(0, s.indexOf(" "));
                }
            }
        }
        //巩膜异常
        String gmqt = "";
        gmqt= ((EditText) view.findViewById( R.id.health_sclera_other_text)).getText().toString();
        params.put( "gmqt", gmqt );

        params.put( "gm", health_sclera_ok );
        //淋巴结
        String health_Lymph_node_ok = "";
        View[] exposedViews1 = getViews(view.findViewById(R.id.cha_ti_2_lbj));
        for (int i = 0; i < exposedViews1.length; i++) {
            if (exposedViews1[i] instanceof RadioButton) {
                RadioButton cb = (RadioButton) exposedViews1[i];
                if (cb.isChecked()) {
                    String s = cb.getText().toString().trim();
                    health_Lymph_node_ok = s.substring(0, s.indexOf(" "));
                }
            }
        }
        String lbjqt ="";
        lbjqt= ((EditText) view.findViewById( R.id.health_Lymph_node_other_text)).getText().toString();
        params.put( "lbjqt", lbjqt );
        params.put( "lbj", health_Lymph_node_ok );
        values.putAll(params);
        JSONObject jsonObject = new JSONObject(params);
        MyLogger.i(jsonObject.toString());
        return params;
    }

    /*
     * 第十一页，查体3
     */

    private Map<String, String> getFamilialDiseaseBrotherValues(View view) {
        Map<String, String> params = new HashMap<>();
        //桶装胸
        String health_Barrel_chest_no = "";
        //health_Barrel_chest_no
        if (((RadioButton) view.findViewById( R.id.health_Barrel_chest_no)).isChecked()){
            health_Barrel_chest_no ="1";
        }else {
            health_Barrel_chest_no ="2";
        }
        params.put("tzx", health_Barrel_chest_no);
        //呼吸音
        String health_breath_sounds_nomal = "";
        if (((RadioButton) view.findViewById( R.id.health_breath_sounds_nomal)).isChecked()){
            health_breath_sounds_nomal ="1";
        }else {
            health_breath_sounds_nomal ="2";
        }
        params.put("hxy", health_breath_sounds_nomal);

        //罗音
        String health_rale_no = "";
        View[] exposedViews1 = getViews(view.findViewById(R.id.cha_ti_3_ly));
        for (int i = 0; i < exposedViews1.length; i++) {
            if (exposedViews1[i] instanceof RadioButton) {
                RadioButton cb = (RadioButton) exposedViews1[i];
                if (cb.isChecked()) {
                    String s = cb.getText().toString().trim();
                    health_rale_no = s.substring(0, s.indexOf(" "));
                }
            }
        }
        String lyqt =" ";
        lyqt= ((EditText) view.findViewById( R.id.health_rale_other_text)).getText().toString();
        params.put( "lyqt", lyqt );
        params.put( "ly", health_rale_no );
        values.putAll(params);
        JSONObject jsonObject = new JSONObject(params);
        MyLogger.i(jsonObject.toString());
        return params;
    }
    /*
     * 第十二页，查体4
     */

    private Map<String, String> getFamilialDiseaseBrotherValues_1(View view) {
        Map<String, String> params = new HashMap<>();
        //心率
        String health_heart_rate = "";
        health_heart_rate= ((EditText) view.findViewById(R.id.health_heart_rate)).getText().toString().trim();
        params.put("xlpc", health_heart_rate);

        //心律
        String health_heart_rhythm_1 = "";
        View[] exposedViews = getViews(view.findViewById(R.id.cha_ti_4_xl));
        for (int i = 0; i < exposedViews.length; i++) {
            if (exposedViews[i] instanceof RadioButton) {
                RadioButton cb = (RadioButton) exposedViews[i];
                if (cb.isChecked()) {
                    String s = cb.getText().toString().trim();
                    health_heart_rhythm_1 = s.substring(0, s.indexOf(" "));

                }
            }
        }
        if (health_heart_rhythm_1.length() != 0) {
            health_heart_rhythm_1.substring(0, health_heart_rhythm_1.length() - 1);
        }
        params.put("xl", health_heart_rhythm_1);

        //杂音
        String health_noise_no = "";
        //health_noise_
        if (((RadioButton) view.findViewById( R.id.health_noise_)).isChecked()){
            health_noise_no="1";
        }else {
            health_noise_no ="2";
        }

        params.put("zy", health_noise_no);
        values.putAll(params);
        JSONObject jsonObject = new JSONObject(params);
        MyLogger.i(jsonObject.toString());
        return params;
    }
    //第十三页  查体5
    private Map<String, String> getFamilialDiseaseBrotherValues_2(View view) {
        Map<String, String> params = new HashMap<>();
        //压痛
        String tenderness_wu = "";
        if (((RadioButton) view.findViewById( R.id.tenderness_wu)).isChecked()){
            tenderness_wu="1";
        }else {
            tenderness_wu ="2";
        }
        params.put("fbyt", tenderness_wu);

        //肝大
        String hepatomegaly_wu = "";

        if (((RadioButton) view.findViewById( R.id.hepatomegaly_wu)).isChecked()){
            hepatomegaly_wu="1";
        }else {
            hepatomegaly_wu ="2";
        }
        params.put("fbgd", hepatomegaly_wu);
        //压痛
        String splenomegaly_wu = "";
        if (((RadioButton) view.findViewById( R.id.splenomegaly_wu)).isChecked()){
            splenomegaly_wu="1";
        }else {
            splenomegaly_wu ="2";
        }
        params.put("fbpd", splenomegaly_wu);

        //移动性浊音
        String mobility_wu = "";
        if (((RadioButton) view.findViewById( R.id.mobility_wu)).isChecked()){
            mobility_wu="1";
        }else {
            mobility_wu ="2";
        }
        params.put("fbydxzy", mobility_wu);
        values.putAll(params);
        JSONObject jsonObject = new JSONObject(params);
        MyLogger.i(jsonObject.toString());
        return params;
    }
    //第十四页  查体6
    private Map<String, String> getFamilialDiseaseBrotherValues_3(View view) {
        Map<String, String> params = new HashMap<>();
        //下肢水肿
        String health_edema_1= "";
        View[] exposedViews = getViews(view.findViewById(R.id.cha_ti_6_xzsz));
        for (int i = 0; i < exposedViews.length; i++) {
            if (exposedViews[i] instanceof RadioButton) {
                RadioButton cb = (RadioButton) exposedViews[i];
                if (cb.isChecked()) {
                    String s = cb.getText().toString().trim();
                    health_edema_1 = s.substring(0, s.indexOf(" "));

                }
            }
        }
        params.put("xzsz", health_edema_1);

        //足背动脉搏动
        String foot_artery_1 = "";
        View[] exposedViews_1 = getViews(view.findViewById(R.id.cha_ti_6_xbdm));
        for (int i = 0; i < exposedViews_1.length; i++) {
            if (exposedViews_1[i] instanceof RadioButton) {
                RadioButton cb = (RadioButton) exposedViews_1[i];
                if (cb.isChecked()) {
                    String s = cb.getText().toString().trim();
                    foot_artery_1 = s.substring(0, s.indexOf(" "));

                }
            }
        }
        //肛门指诊
        String health_dre_1 = "";
        View[] exposedViews_2 = getViews(view.findViewById(R.id.cha_ti_6_gm));
        for (int i = 0; i < exposedViews_2.length; i++) {
            if (exposedViews_2[i] instanceof RadioButton) {
                RadioButton cb = (RadioButton) exposedViews_2[i];
                if (cb.isChecked()) {
                    String s = cb.getText().toString().trim();
                    health_dre_1= s.substring(0, s.indexOf(" "));

                }
            }
        }

        params.put("zbdmbd", foot_artery_1);


        params.put( "gmzz", health_dre_1 );
        values.putAll(params);
        JSONObject jsonObject = new JSONObject(params);
        MyLogger.i(jsonObject.toString());
        return params;
    }
    //第十四页  查体7
    private Map<String, String> getFamilialDiseaseBrotherValues_4(View view) {
        Map<String, String> params = new HashMap<>();
        /*
         * 基本信息
         */
        String health_breast_none = "";
        String health_allergy_other_text = "";
        if (view != null) {
            View[] PastHistoryFatherViews= getViews(view.findViewById(R.id.archives_allergy));
            for (int i = 0; i < PastHistoryFatherViews.length; i++) {
                if (PastHistoryFatherViews[i] instanceof CheckBox) {
                    CheckBox cb = (CheckBox) PastHistoryFatherViews[i];
                    if (cb.isChecked()) {
                        String s = cb.getText().toString().trim();
                        s = s.substring(0, s.indexOf(" "));
                        health_breast_none += s;
                        health_breast_none += ",";
                    }
                }
            }
            if (health_breast_none.length() != 0) {
                health_breast_none = health_breast_none.substring(0, health_breast_none.length() - 1);
            }
            health_allergy_other_text = ((EditText) view.findViewById(R.id.health_allergy_other_text)).getText().toString().trim();
        }
        params.put("rx", health_breast_none);
        params.put("rxQt", health_allergy_other_text);//乳腺其他

        // 外阴
        String vulva = "0";
        // 阴道
        String vagina = "0";
        // 宫颈
        String cervical = "0";

        vulva = ((Spinner) view.findViewById(R.id.vulva)).getSelectedItem().toString().trim();
        vagina = ((Spinner) view.findViewById(R.id.vagina)).getSelectedItem().toString().trim();
        cervical = ((Spinner) view.findViewById(R.id.cervical)).getSelectedItem().toString().trim();
        vagina = vagina.substring(0, vagina.indexOf(" "));
        vulva = vulva.substring(0, vulva.indexOf(" "));
        cervical = cervical.substring(0, cervical.indexOf(" "));
        params.put("fkWy", vulva);//外阴
        params.put("fkYd", vagina);//阴道
        params.put("fkGj", cervical);//宫颈
        // 宫体
        String uterine = "0";
        // 附件
        String enclosure = "0";
        // 其他
        String health_gynaecology_other = "";

        uterine = ((Spinner) view.findViewById(R.id.uterine)).getSelectedItem().toString().trim();
        enclosure = ((Spinner) view.findViewById(R.id.enclosure)).getSelectedItem().toString().trim();
        health_gynaecology_other = ((EditText) view.findViewById(R.id.health_gynaecology_other)).getText().toString().trim();
        uterine =  uterine.substring(0,  uterine.indexOf(" "));
        enclosure = enclosure.substring(0, enclosure.indexOf(" "));
        params.put("fkGtms", uterine);//宫体
        params.put("fkFj", enclosure);//附件
        params.put("fkQt", health_gynaecology_other);//其他
        values.putAll(params);
        JSONObject jsonObject = new JSONObject(params);
        MyLogger.i(jsonObject.toString());
        return params;
    }
    /**
     * 获取页面数据
     *
     * @return 封装好的数据
     */
    /*
     * 第x页，辅助检查一
     */
    private Map<String, String> examineOne(View view){
        Map<String, String> params = new HashMap<>();
        // 血红蛋白
        String hemoglobin = "";
        // 白细胞
        String hemameba = "";
        // 血小板
        String thrombocyte = "";
        // 其它
        String other1 = "";
        // 尿蛋白
        String urineprotein = "";
        //尿糖
        String urinesugar = "";
        // 尿酮体
        String urineacetonebodies = "";
        // 尿潜血
        String urineoccultblood = "";
        //其它
        String other2 = "";
        // 空腹血糖
        String fastingbloodglucose1= "";
        String fastingbloodglucose2= "";
        // 心电图
        String Electrocardiograph = "";
        String xdtYc ="";
        hemoglobin = ((EditText) view.findViewById(R.id.health_hemoglobin)).getText().toString().trim();
        hemameba = ((EditText) view.findViewById(R.id.health_hemameba)).getText().toString().trim();
        thrombocyte = ((EditText) view.findViewById(R.id.health_soterocyte)).getText().toString().trim();
        other1 = ((EditText) view.findViewById(R.id.health_other01)).getText().toString().trim();
        urineprotein = ((EditText) view.findViewById(R.id.health_PRO)).getText().toString().trim();
        urinesugar = ((EditText) view.findViewById(R.id.health_UGLU)).getText().toString().trim();
        urineacetonebodies = ((EditText) view.findViewById(R.id.health_urineacetonebodies)).getText().toString().trim();
        urineoccultblood = ((EditText) view.findViewById(R.id.health_urineoccultblood)).getText().toString().trim();
        other2 = ((EditText) view.findViewById(R.id.health_other02)).getText().toString().trim();
        fastingbloodglucose1 = ((EditText) view.findViewById(R.id.health_FBG1)).getText().toString().trim();
        fastingbloodglucose2 = ((EditText) view.findViewById(R.id.health_FBG2)).getText().toString().trim();
        Electrocardiograph = ((Spinner) view.findViewById(R.id.health_ECG)).getSelectedItem().toString().trim();
        Electrocardiograph = Electrocardiograph.substring(0, Electrocardiograph.indexOf(" "));
        xdtYc = ((EditText) view.findViewById(R.id.health_xdt_yc)).getText().toString().trim();

        params.put("xcgXhdb", hemoglobin);//
        params.put("xcgBxb", hemameba);//
        params.put("xcgXxb", thrombocyte);//
        params.put("xcgQt", other1);////血常规其他
        params.put("ncgNdb", urineprotein);//
        params.put("ncgNt", urinesugar);//
        params.put("ncgNtt", urineacetonebodies);//
        params.put("ncgNqx", urineoccultblood);//
        params.put("ncgQt", other2);//
        params.put("kfxt1", fastingbloodglucose1);//
        params.put("kfxt2", fastingbloodglucose2);//
        params.put("xdt", Electrocardiograph);////心电图
        params.put("xdtYc", xdtYc);//心电图异常
        values.putAll(params);
        JSONObject jsonObject = new JSONObject(params);
        MyLogger.i(jsonObject.toString());
        return params;
    }
    /*
     * 第X页，辅助检查
     */
    private Map<String, String> examineTwo(View view) {
        Map<String, String> params = new HashMap<>();
        //尿微量白蛋白
        String microalbuminuria = "";
        // 大便潜血
        String bloodinstool = "";
        // 糖化血红蛋白
        String glycosylatedhemoglobin = "";
        // 乙型肝炎表面抗原
        String antigen = "";
        //血清谷丙转氨酶
        String ALT = "";
        // 血清谷草转氨酶
        String SGOT = "";
        // 白蛋白
        String albumin = "";
        // 总胆红素
        String TBil = "";
        // 结合胆红素
        String directbilirubin = "";
        microalbuminuria = ((EditText) view.findViewById(R.id.health_microalbuminuria)).getText().toString().trim();
        bloodinstool = ((Spinner) view.findViewById(R.id.health_bloodinstool)).getSelectedItem().toString().trim();
        bloodinstool = bloodinstool.substring(0, bloodinstool.indexOf(" "));
        glycosylatedhemoglobin = ((EditText) view.findViewById(R.id.health_glycosylatedhemoglobin)).getText().toString().trim();
        antigen = ((Spinner) view.findViewById(R.id.health_antigen)).getSelectedItem().toString().trim();
        antigen = antigen.substring(0, antigen.indexOf(" "));
        ALT = ((EditText) view.findViewById(R.id.health_ALT)).getText().toString().trim();
        SGOT = ((EditText) view.findViewById(R.id.health_SGOT)).getText().toString().trim();
        albumin = ((EditText) view.findViewById(R.id.health_albumin)).getText().toString().trim();
        TBil = ((EditText) view.findViewById(R.id.health_TBil)).getText().toString().trim();
        directbilirubin = ((TextView) view.findViewById(R.id.health_directbilirubin)).getText().toString().trim();
        params.put("nwlbdb", microalbuminuria);//尿微量白蛋白
        params.put("dbqx", bloodinstool);//大便潜血
        params.put("thxhdb", glycosylatedhemoglobin);//糖化血红蛋白
        params.put("yxgy", antigen);
        params.put("ggXqgbzam", ALT);
        params.put("ggXqgczam", SGOT);
        params.put("ggBdb", albumin);
        params.put("ggZdhs", TBil);
        params.put("ggJhdhs", directbilirubin);//肝功_结合胆红素
        values.putAll(params);
        JSONObject jsonObject = new JSONObject(params);
        MyLogger.i(jsonObject.toString());
        return params;
    }

    // 第X页，辅助检查3
    private Map<String, String> examineThree(View view) {
        Map<String, String> params = new HashMap<>();
        //血清肌酐
        String serumcreatinine="";
        //血尿素
        String bloodurea="";
        //血钾浓度
        String potassiumconcentration="";
        //血钠浓度
        String serumsodiumconcentration="";
        //总胆固醇
        String totalcholesterol="";
        //甘油三酯
        String triglyceride="";
        //血清低密度脂蛋白胆固醇
        String serumlowdensitycholesterol="";
        //血清高密度脂蛋白胆固醇
        String serumhighdensitycholesterol="";
        //胸部X线片
        String Xray="";
        //腹部B超
        String Btype="";
        //其他
        String others="";
        //宫颈涂片
        String cervicalsmear="";
        //其他
        String other="";
        serumcreatinine = ((EditText) view.findViewById(R.id.health_serumcreatinine)).getText().toString().trim();
        bloodurea = ((EditText) view.findViewById(R.id.health_bloodurea)).getText().toString().trim();
        potassiumconcentration = ((EditText) view.findViewById(R.id.health_potassiumconcentration)).getText().toString().trim();
        serumsodiumconcentration = ((EditText) view.findViewById(R.id.health_serumsodiumconcentration)).getText().toString().trim();
        totalcholesterol = ((EditText) view.findViewById(R.id.health_totalcholesterol)).getText().toString().trim();
        triglyceride = ((EditText) view.findViewById(R.id.health_triglyceride)).getText().toString().trim();
        serumlowdensitycholesterol = ((EditText) view.findViewById(R.id.health_serumlowdensitycholesterol)).getText().toString().trim();
        serumhighdensitycholesterol = ((EditText) view.findViewById(R.id.health_serumhighdensitycholesterol)).getText().toString().trim();
        Xray = ((Spinner) view.findViewById(R.id.health_Xray)).getSelectedItem().toString().trim();
        Xray = Xray.substring(0,Xray.indexOf(" "));
        Btype = ((Spinner) view.findViewById(R.id.health_Btype)).getSelectedItem().toString().trim();
        Btype = Btype.substring(0,Btype.indexOf(" "));
        others = ((Spinner) view.findViewById(R.id.health_others)).getSelectedItem().toString().trim();
        others = Btype.substring(0,others.indexOf(" "));
        cervicalsmear = ((Spinner) view.findViewById(R.id.health_cervicalsmear)).getSelectedItem().toString().trim();
        cervicalsmear = Btype.substring(0,cervicalsmear.indexOf(" "));
        other = ((EditText) view.findViewById(R.id.health_other03)).getText().toString().trim();
        String bcYc ="";
        bcYc= ((EditText) view.findViewById(R.id.health_bc_yc)).getText().toString().trim();

        params.put("sgXqjg", serumcreatinine);//肾功_血清肌酐
        params.put("sgXns", bloodurea);//肾功_血尿素
        params.put("sgXjnd", potassiumconcentration);
        params.put("sgXnnd", serumsodiumconcentration);
        params.put("xzZdgc", totalcholesterol);
        params.put("xzGysz", triglyceride);
        params.put("xzXqdmdzdbdgc", serumlowdensitycholesterol);//血脂_血清低密度脂蛋白胆固醇
        params.put("xzXqgmdzdbdgc", serumhighdensitycholesterol);
        params.put("xbxxp", Xray);//胸部X线片
        params.put("bcFbbc", Btype);
        params.put("bcQt", others);
        params.put("bcYc", bcYc);
        params.put("gjtp", cervicalsmear);//宫颈涂片
        params.put("fzjcQt", other);////辅助检查其他
        values.putAll(params);
        JSONObject jsonObject = new JSONObject(params);
        MyLogger.i(jsonObject.toString());
        return params;
    }
    /**
     * 第X页，现存主要健康问题1
     */
    private Map<String, String> healthProblemOne(View view) {
        Map<String, String> params = new HashMap<>();

        // 脑血管疾病
        String cerebrovascular="";
        String cerebrovascularother="";
        // 肾脏疾病
        String nephropathy="";
        String nephropathyother="";
        if (view != null) {
            View[] familialDiseaseFatherViews = getViews(view.findViewById(R.id.health_cerebrovasculardisease));
            for (int i = 0; i < familialDiseaseFatherViews.length; i++) {
                if (familialDiseaseFatherViews[i] instanceof CheckBox) {
                    CheckBox cb = (CheckBox) familialDiseaseFatherViews[i];
                    if (cb.isChecked()) {
                        String s = cb.getText().toString().trim();
                        s = s.substring(0, s.indexOf(" "));
                        cerebrovascular += s;
                        cerebrovascular += ",";
                    }
                }
            }
            if (cerebrovascular.length() != 0) {
                cerebrovascular = cerebrovascular.substring(0, cerebrovascular.length() - 1);
            }
            cerebrovascularother = ((EditText) view.findViewById(R.id.health_other_text1)).getText().toString().trim();
        }
        if (view != null) {
            View[] familialDiseaseFatherViews = getViews(view.findViewById(R.id.health_kidneydisease));
            for (int i = 0; i < familialDiseaseFatherViews.length; i++) {
                if (familialDiseaseFatherViews[i] instanceof CheckBox) {
                    CheckBox cb = (CheckBox) familialDiseaseFatherViews[i];
                    if (cb.isChecked()) {
                        String s = cb.getText().toString().trim();
                        s = s.substring(0, s.indexOf(" "));
                        nephropathy += s;
                        nephropathy += ",";
                    }
                }
            }
            if (nephropathy.length() != 0) {
                nephropathy = nephropathy.substring(0, nephropathy.length() - 1);
            }
            nephropathyother = ((EditText) view.findViewById(R.id.health_other_text2)).getText().toString().trim();
        }
        params.put("nxgjb", cerebrovascular);//脑血管疾病
        params.put("nxgjbQt", cerebrovascularother);//脑血管疾病_其他
        params.put("szjb", nephropathy);//肾脏疾病
        params.put("szjbQt", nephropathyother);//其他
        values.putAll(params);
        JSONObject jsonObject = new JSONObject(params);
        MyLogger.i(jsonObject.toString());
        return params;
    }

    //第X页，现存主要健康问题2
    private Map<String, String> healthProblemTwo(View view) {
        Map<String, String> params = new HashMap<>();

        //心脏疾病
        String heartdisease="";
        String heartdiseaseother="";
        //血管疾病
        String vasculardisease="";
        String vasculardiseaseother="";
        if (view != null) {
            View[] familialDiseaseFatherViews = getViews(view.findViewById(R.id.health_heartdisease));
            for (int i = 0; i < familialDiseaseFatherViews.length; i++) {
                if (familialDiseaseFatherViews[i] instanceof CheckBox) {
                    CheckBox cb = (CheckBox) familialDiseaseFatherViews[i];
                    if (cb.isChecked()) {
                        String s = cb.getText().toString().trim();
                        s = s.substring(0, s.indexOf(" "));
                        heartdisease += s;
                        heartdisease += ",";
                    }
                }
            }
            if (heartdisease.length() != 0) {
                heartdisease = heartdisease.substring(0, heartdisease.length() - 1);
            }
            heartdiseaseother = ((EditText) view.findViewById(R.id.health_other_text3)).getText().toString().trim();
        }
        if (view != null) {
            View[] familialDiseaseFatherViews = getViews(view.findViewById(R.id.health_vasculardisease));
            for (int i = 0; i < familialDiseaseFatherViews.length; i++) {
                if (familialDiseaseFatherViews[i] instanceof CheckBox) {
                    CheckBox cb = (CheckBox) familialDiseaseFatherViews[i];
                    if (cb.isChecked()) {
                        String s = cb.getText().toString().trim();
                        s = s.substring(0, s.indexOf(" "));
                        vasculardisease += s;
                        vasculardisease += ",";
                    }
                }
            }
            if (vasculardisease.length() != 0) {
                vasculardisease = vasculardisease.substring(0, vasculardisease.length() - 1);
            }
            vasculardiseaseother = ((EditText) view.findViewById(R.id.health_other_text4)).getText().toString().trim();
        }
        params.put("xzjb", heartdisease);
        params.put("xzjbQt", heartdiseaseother);
        params.put("xgjb", vasculardisease);
        params.put("xgjbQt", vasculardiseaseother);
        values.putAll(params);
        JSONObject jsonObject = new JSONObject(params);
        MyLogger.i(jsonObject.toString());
        return params;
    }

    /*
     *第X页，现存主要健康问题3
     */
    private Map<String, String> healthProblemThree(View view) {
        Map<String, String> params = new HashMap<>();
        // 眼部疾病
        String eyedisease="";
        String eyediseaseother="";
        // 神经系统疾病
        String nervoussystemdisease="";
        // 其他系统疾病
        String otherdisease="";
        if (view != null) {
            View[] familialDiseaseFatherViews = getViews(view.findViewById(R.id.health_eyedisease));
            for (int i = 0; i < familialDiseaseFatherViews.length; i++) {
                if (familialDiseaseFatherViews[i] instanceof CheckBox) {
                    CheckBox cb = (CheckBox) familialDiseaseFatherViews[i];
                    if (cb.isChecked()) {
                        String s = cb.getText().toString().trim();
                        s = s.substring(0, s.indexOf(" "));
                        eyedisease += s;
                        eyedisease += ",";
                    }
                }
            }
            if (eyedisease.length() != 0) {
                eyedisease = eyedisease.substring(0, eyedisease.length() - 1);
            }
            eyediseaseother = ((EditText) view.findViewById(R.id.health_other_text5)).getText().toString().trim();
        }
        nervoussystemdisease = ((Spinner) view.findViewById(R.id.health_nervoussystemdisease)).getSelectedItem().toString().trim();
        nervoussystemdisease = nervoussystemdisease.substring(0,nervoussystemdisease.indexOf(" "));
        otherdisease = ((Spinner) view.findViewById(R.id.health_otherdisease)).getSelectedItem().toString().trim();
        otherdisease = otherdisease.substring(0,otherdisease.indexOf(" "));
        params.put("ybjb",eyedisease);
        params.put("ybjbQt",eyediseaseother);
        params.put("sjxtjb",nervoussystemdisease);
        params.put("qtxtjb",otherdisease);//其他系统疾病
        values.putAll(params);
        JSONObject jsonObject = new JSONObject(params);
        MyLogger.i(jsonObject.toString());
        return params;
    }

    /**
     * 第X页，住院治疗情况
     */
    private Map<String, String> hospitalization(View view) {
        Map<String, String> params = new HashMap<>();

        // 入院日期
        String admissionDate1="";
        //出院日期
        String dateOfDischarge1="";
        // 原因
        String cause1="";
        //医疗机构名称
        String medicalestablishment1="";
        // 病案号
        String identificationnumber1="";
        //建床日期
        String admissionDate2="";
        // 撤床日期
        String dateOfDischarge2="";
        // 原因
        String cause2="";
        //医疗机构名称
        String medicalestablishment2="";
        // 病案号
        String identificationnumber2="";
        admissionDate1 = ((TextView) view.findViewById(R.id.health_admitted1)).getText().toString().trim();
        dateOfDischarge1 = ((TextView) view.findViewById(R.id.health_leave1)).getText().toString().trim();
        cause1 = ((EditText) view.findViewById(R.id.health_cause1)).getText().toString().trim();
        medicalestablishment1 = ((EditText) view.findViewById(R.id.health_medicalestablishment1)).getText().toString().trim();
        identificationnumber1 = ((EditText) view.findViewById(R.id.health_identificationnumber1)).getText().toString().trim();
        admissionDate2 = ((TextView) view.findViewById(R.id.health_admitted2)).getText().toString().trim();
        dateOfDischarge2 = ((TextView) view.findViewById(R.id.health_leave2)).getText().toString().trim();
        cause2 = ((EditText) view.findViewById(R.id.health_cause2)).getText().toString().trim();
        medicalestablishment2 = ((EditText) view.findViewById(R.id.health_medicalestablishment2)).getText().toString().trim();
        identificationnumber2 = ((EditText) view.findViewById(R.id.health_identificationnumber2)).getText().toString().trim();
        params.put("zys1Ryrq", admissionDate1);
        params.put("zys1Cyrq", dateOfDischarge1);
        params.put("zys1Yy", cause1);
        params.put("zys1Yljgmc", medicalestablishment1);
        params.put("zys1Bah", identificationnumber1);//住院史1_病案号
        params.put("jtbcs1Jcrq", admissionDate2);
        params.put("jtbcs1Ccrq", dateOfDischarge2);
        params.put("jtbcs1Yy", cause2);
        params.put("jtbcs1Yljgmc", medicalestablishment2);
        params.put("jtbcs1Bah", identificationnumber2);
        values.putAll(params);
        JSONObject jsonObject = new JSONObject(params);
        MyLogger.i(jsonObject.toString());
        return params;
    }

    //第X页，主要用药情况1
    private Map<String, String> medicationOne(View view) {
        Map<String, String> params = new HashMap<>();

        //药物名称
        String drugNames1="";
        //用法
        String Numbers1="";
        //用量
        String dosage1="";
        //用药时间
        String medicationTime1="";
        //药物名称
        String drugNames2="";
        //用法
        String Numbers2="";
        //用量
        String dosage2="";
        //用药时间
        String medicationTime2="";
        //药物名称
        String drugNames3="";
        //用法
        String Numbers3="";
        //用量
        String dosage3="";
        //用药时间
        String medicationTime3="";
        drugNames1 = ((EditText) view.findViewById(R.id.myhealth_drugNames1)).getText().toString().trim();
        Numbers1 = ((EditText) view.findViewById(R.id.myhealth_Numbers1)).getText().toString().trim();
        dosage1 = ((EditText) view.findViewById(R.id.myhealth_dosage1)).getText().toString().trim();
        medicationTime1 = ((TextView) view.findViewById(R.id.myhealth_medicationTime1)).getText().toString().trim();
        drugNames2 = ((EditText) view.findViewById(R.id.myhealth_drugNames2)).getText().toString().trim();
        Numbers2 = ((EditText) view.findViewById(R.id.myhealth_Numbers2)).getText().toString().trim();
        dosage2 = ((EditText) view.findViewById(R.id.myhealth_dosage2)).getText().toString().trim();
        medicationTime2 = ((TextView) view.findViewById(R.id.myhealth_medicationTime2)).getText().toString().trim();
        drugNames3 = ((EditText) view.findViewById(R.id.myhealth_drugNames3)).getText().toString().trim();
        Numbers3 = ((EditText) view.findViewById(R.id.myhealth_Numbers3)).getText().toString().trim();
        dosage3 = ((EditText) view.findViewById(R.id.myhealth_dosage3)).getText().toString().trim();
        medicationTime3 = ((TextView) view.findViewById(R.id.myhealth_medicationTime3)).getText().toString().trim();
        params.put("yyqk1Yymc", drugNames1);
        params.put("yyqk1Yf", Numbers1);
        params.put("yyqk1Yl", dosage1);
        params.put("yyqk1Yysj", medicationTime1);
        params.put("yyqk2Yymc", drugNames2);
        params.put("yyqk2Yf", Numbers2);
        params.put("yyqk2Yl", dosage2);
        params.put("yyqk2Yysj", medicationTime2);
        params.put("yyqk3Yymc", drugNames3);//药物名称
        params.put("yyqk3Yf", Numbers3);//用法
        params.put("yyqk3Yl", dosage3);//用量
        params.put("yyqk3Yysj", medicationTime3);//用药时间
        values.putAll(params);
        JSONObject jsonObject = new JSONObject(params);
        MyLogger.i(jsonObject.toString());
        return params;
    }
    //第X页，主要用药情况2
    private Map<String, String> medicationTwo(View view) {
        Map<String, String> params = new HashMap<>();

        //药物名称
        String drugNames4="";
        //用法
        String Numbers4="";
        //用量
        String dosage4="";
        //用药时间
        String medicationTime4="";
        //药物名称
        String drugNames5="";
        //用法
        String Numbers5="";
        //用量
        String dosage5="";
        //用药时间
        String medicationTime5="";
        //药物名称
        String drugNames6="";
        //用法
        String Numbers6="";
        //用量
        String dosage6="";
        //用药时间
        String medicationTime6="";
        drugNames4 = ((EditText) view.findViewById(R.id.myhealth_drugNames4)).getText().toString().trim();
        Numbers4 = ((EditText) view.findViewById(R.id.myhealth_Numbers4)).getText().toString().trim();
        dosage4 = ((EditText) view.findViewById(R.id.myhealth_dosage4)).getText().toString().trim();
        medicationTime4 = ((TextView) view.findViewById(R.id.myhealth_medicationTime4)).getText().toString().trim();
        drugNames5 = ((EditText) view.findViewById(R.id.myhealth_drugNames5)).getText().toString().trim();
        Numbers5 = ((EditText) view.findViewById(R.id.myhealth_Numbers5)).getText().toString().trim();
        dosage5 = ((EditText) view.findViewById(R.id.myhealth_dosage5)).getText().toString().trim();
        medicationTime5 = ((TextView) view.findViewById(R.id.myhealth_medicationTime5)).getText().toString().trim();
        drugNames6 = ((EditText) view.findViewById(R.id.myhealth_drugNames6)).getText().toString().trim();
        Numbers6 = ((EditText) view.findViewById(R.id.myhealth_Numbers6)).getText().toString().trim();
        dosage6 = ((EditText) view.findViewById(R.id.myhealth_dosage6)).getText().toString().trim();
        medicationTime6 = ((TextView) view.findViewById(R.id.myhealth_medicationTime6)).getText().toString().trim();
       /* params.put("ywmc4", drugNames4);
        params.put("yf4", Numbers4);
        params.put("yl4", dosage4);
        params.put("yysj4", medicationTime4);
        params.put("ywmc5", drugNames5);
        params.put("yf5", Numbers5);
        params.put("yl5", dosage5);
        params.put("yysj5", medicationTime5);
        params.put("ywmc6", drugNames6);
        params.put("yf6", Numbers6);
        params.put("yl6", dosage6);
        params.put("yysj6", medicationTime6);*/

        params.put("yyqk4Yymc", drugNames4);
        params.put("yyqk4Yf", Numbers4);
        params.put("yyqk4Yl", dosage4);
        params.put("yyqk4Yysj", medicationTime4);
        params.put("yyqk5Yymc", drugNames5);
        params.put("yyqk5Yf", Numbers5);
        params.put("yyqk5Yl", dosage5);
        params.put("yyqk5Yysj", medicationTime5);
        params.put("yyqk6Yymc", drugNames6);//药物名称
        params.put("yyqk6Yf", Numbers6);//用法
        params.put("yyqk6Yl", dosage6);//用量
        params.put("yyqk6Yysj", medicationTime6);//用药时间
        values.putAll(params);
        JSONObject jsonObject = new JSONObject(params);
        MyLogger.i(jsonObject.toString());
        return params;
    }
    //第X页，非免疫规划预防接种史
    private Map<String, String> prophylacticVaccination(View view) {
        Map<String, String> params = new HashMap<>();

        //名称
        String Names1="";
        //接种日期
        String birthday1="";
        //接种机构
        String VaccinationAgency1="";
        //名称
        String Names2="";
        //接种日期
        String birthday2="";
        //接种机构
        String VaccinationAgency2="";
        //名称
        String Names3="";
        //接种日期
        String birthday3="";
        //接种机构
        String VaccinationAgency3="";
        Names1 = ((EditText) view.findViewById(R.id.myhealth_Names1)).getText().toString().trim();
        birthday1 = ((TextView) view.findViewById(R.id.myhealth_birthday1)).getText().toString().trim();
        VaccinationAgency1 = ((EditText) view.findViewById(R.id.myhealth_VaccinationAgency1)).getText().toString().trim();
        Names2 = ((EditText) view.findViewById(R.id.myhealth_Names2)).getText().toString().trim();
        birthday2 = ((TextView) view.findViewById(R.id.myhealth_birthday2)).getText().toString().trim();
        VaccinationAgency2 = ((EditText) view.findViewById(R.id.myhealth_VaccinationAgency2)).getText().toString().trim();
        Names3 = ((EditText) view.findViewById(R.id.myhealth_Names3)).getText().toString().trim();
        birthday3 = ((TextView) view.findViewById(R.id.myhealth_birthday3)).getText().toString().trim();
        VaccinationAgency3 = ((EditText) view.findViewById(R.id.myhealth_VaccinationAgency3)).getText().toString().trim();
        params.put("fmyghyfjzs1Mc", Names1);
        params.put("fmyghyfjzs1Jzrq", birthday1);
        params.put("fmyghyfjzs1Jzjg", VaccinationAgency1);
        params.put("fmyghyfjzs2Mc", Names2);
        params.put("fmyghyfjzs2Jzrq", birthday2);
        params.put("fmyghyfjzs2Jzjg", VaccinationAgency2);
        params.put("fmyghyfjzs3Mc", Names3);
        params.put("fmyghyfjzs3Jzrq", birthday3);
        params.put("fmyghyfjzs3Jzjg", VaccinationAgency3);
        values.putAll(params);
        JSONObject jsonObject = new JSONObject(params);
        MyLogger.i(jsonObject.toString());
        return params;
    }
    //第X页，健康评价与健康指导
    private Map<String, String> EvaluationAndGuidance(View view) {
        Map<String, String> params = new HashMap<>();

        //健康评价
        String healthAssessment="";
        //健康指导
        String guidance="";
        if (((RadioButton) view.findViewById(R.id.myhealth_Assessment_none)).isChecked()) {
            healthAssessment = "1";
        } else {
            healthAssessment = "2";
        }
        View[] payViews = getViews(view.findViewById(R.id.myhealth_guidance));
        for (int i = 0; i < payViews.length; i++) {
            if (payViews[i] instanceof CheckBox) {
                CheckBox cb = (CheckBox) payViews[i];
                if (cb.isChecked()) {
                    String s = cb.getText().toString().trim();
                    s = s.substring(0, s.indexOf(" "));
                    guidance += s;
                    guidance += ",";
                }
            }
        }
        //myhealth_Assessment_abnormal1

        String yc1="";
        String yc2="";
        String yc3="";
        String yc4="";
         yc1 = ( (EditText)view.findViewById(R.id.myhealth_Assessment_abnormal1)).getText().toString().trim();
        yc2 = ( (EditText)view.findViewById(R.id.myhealth_Assessment_abnormal2)).getText().toString().trim();
        yc3 = ( (EditText)view.findViewById(R.id.myhealth_Assessment_abnormal3)).getText().toString().trim();
        yc4 = ( (EditText)view.findViewById(R.id.myhealth_Assessment_abnormal4)).getText().toString().trim();
         if (guidance.length() != 0) {
            guidance = guidance.substring(0, guidance.length() - 1);
        }
        params.put("jkpj", healthAssessment);//健康评价
        params.put("jkzd", guidance);//健康指导
        params.put("jkpjYc1", yc1);//异常
        params.put("jkpjYc2", yc2);//异常
        params.put("jkpjYc3", yc3);//异常
        params.put("jkpjYc4", yc4);//异常
        values.putAll(params);
        JSONObject jsonObject = new JSONObject(params);
        MyLogger.i(jsonObject.toString());
        return params;
    }
    //第X页，危险因素控制
    private Map<String, String> RiskFactorControl(View view) {
        Map<String, String> params = new HashMap<>();

        //危险因素控制
        String RiskFactor="";
        String RiskFactorWeight="";
        String RiskFactorother="";
        View[] payViews = getViews(view.findViewById(R.id.myhealth_RiskFactorControl));
        for (int i = 0; i < payViews.length; i++) {
            if (payViews[i] instanceof CheckBox) {
                CheckBox cb = (CheckBox) payViews[i];
                if (cb.isChecked()) {
                    String s = cb.getText().toString().trim();
                    s = s.substring(0, s.indexOf(" "));
                    RiskFactor += s;
                    RiskFactor += ",";
                }
            }
        }
        if (RiskFactor.length() != 0) {
            RiskFactor = RiskFactor.substring(0, RiskFactor.length() - 1);
        }
        RiskFactorWeight = ((EditText) view.findViewById(R.id.myhealth_Risk_weightReduction_text)).getText().toString().trim();
        RiskFactorother = ((EditText) view.findViewById(R.id.myhealth_Risk_other_text)).getText().toString().trim();
        params.put("wxyskz", RiskFactor);
        params.put("wxyskzJtz", RiskFactorWeight);
        params.put("wxyskzQt", RiskFactorother);
        // 下次随访日期
        String followupdate = "";
        followupdate = ((TextView) view.findViewById(R.id.a_postpartum_housecall_next_follow_up_date)).getText().toString().trim();
        params.put("scsfsj", followupdate);//随访时间
        JSONObject jsonObject = new JSONObject(params);
        MyLogger.i(jsonObject.toString());
        values.putAll(params);
        return params;
    }
    /**
     * Toolbar的事件---返回
     */
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if (item.getItemId() == android.R.id.home) {
            finish();
        }
        return super.onOptionsItemSelected(item);
    }

    /**
     * 点击日期选择框弹出DatePickerDialog
     */
    private Calendar calendar;
    private DatePickerDialog dialog;

    public void onTimeViewClick(final View v) {
        calendar = Calendar.getInstance();
        dialog = new DatePickerDialog(HealthCheckArchivesActivity.this,
                new DatePickerDialog.OnDateSetListener() {
                    @Override
                    public void onDateSet(DatePicker view, int year,
                                          int monthOfYear, int dayOfMonth) {
                        TextView tv = (TextView) v;
                        String month;
                        String day;
                        if (monthOfYear <9){
                            month = "0"+(monthOfYear+1);
                        }else {
                            month = ""+(monthOfYear+1);
                        }
                        if (dayOfMonth <10){
                            day = "0"+dayOfMonth;
                        }else {
                            day = dayOfMonth + "";
                        }
                        tv.setText(year + "-" + month  + "-" + day);
                    }
                }, calendar.get(Calendar.YEAR), calendar
                .get(Calendar.MONTH), calendar
                .get(Calendar.DAY_OF_MONTH));
        dialog.show();
    }

    /*症状*/
    public void onSymptomClick(View view) {
        CheckBox none = findViewById(R.id.health_symptom_1);
        CheckBox other = findViewById(R.id.health_symptom_25);
        EditText otherText = findViewById(R.id.health_symptom_25_text);
        View[] views = getViews(findViewById(R.id.health_symptom));
        boolean flag = false;
        for (int i = 0; i < views.length; i++) {
            if (views[i] instanceof CheckBox) {
                CheckBox cb = (CheckBox) views[i];
                if (cb.isChecked()) {
                    flag = true;
                }
                if (view.getId() == R.id.health_symptom_1 && cb.getId() != R.id.health_symptom_1) {
                    if (none.isChecked()) {
                        cb.setChecked(false);
                        otherText.setText("");
                        otherText.setEnabled(false);
                    }
                } else if (view.getId() != R.id.health_symptom_1) {
                    if (cb.isChecked()) {
                        none.setChecked(false);
                    }
                }
            }
        }
        if (flag != true) {
            none.setChecked(true);
        }
        if (other.isChecked()) {
            otherText.setEnabled(true);
        } else {
            otherText.setText("");
            otherText.setEnabled(false);
        }
    }
    /*老年人认知功能*/
    public void onCognitionClick(View view) {
        EditText et1 = findViewById(R.id.health_cognition_name);
        if (view.getId() == R.id.health_cognition_1) {
            et1.setText("");
            et1.setEnabled(false);
        } else {
            et1.setEnabled(true);
            et1.setFocusable(true);
            et1.setFocusableInTouchMode(true);
            et1.requestFocus();
        }
    }
    /*老年人情感状态*/
    public void onEmotionClick(View view) {
        EditText et1 = findViewById(R.id.health_emotion_name);
        if (view.getId() == R.id.health_emotion_1) {
            et1.setText("");
            et1.setEnabled(false);
        } else {
            et1.setEnabled(true);
            et1.setFocusable(true);
            et1.setFocusableInTouchMode(true);
            et1.requestFocus();
        }
    }

    /*是否戒酒*/
    public void oneQuitAlcoholClick(View view) {
        EditText et1 = findViewById(R.id.health_alcohol_quit_age);
        if (view.getId() == R.id.health_alcohol_quit_yes) {
            et1.setText("");
            et1.setEnabled(false);
        } else {
            et1.setEnabled(true);
            et1.setFocusable(true);
            et1.setFocusableInTouchMode(true);
            et1.requestFocus();
        }
    }

    /*饮酒种类*/
    public void onTypeClick(View view) {
        EditText et1 = findViewById(R.id.health_alcohol_type_other_name);
        if (view.getId() == R.id.health_alcohol_type_1) {
            et1.setText("");
            et1.setEnabled(false);
        } else {
            et1.setEnabled(true);
            et1.setFocusable(true);
            et1.setFocusableInTouchMode(true);
            et1.requestFocus();
        }
    }

    /*职业病危害因素接触史*/
    public void onOccupationalDiseaseClick(View view) {
        EditText et1 = findViewById(R.id.health_occupational_disease_name);
        EditText et2 = findViewById(R.id.health_occupational_disease_year);
        EditText et3 = findViewById(R.id.health_ccupational_disease_name_1);
        EditText et4 = findViewById(R.id.health_ccupational_disease_name_2);
        EditText et5 = findViewById(R.id.health_ccupational_disease_name_3);
        EditText et6 = findViewById(R.id.health_ccupational_disease_name_4);
        EditText et7 = findViewById(R.id.health_ccupational_disease_name_other);
        RadioButton rb = (RadioButton) view;
        if (view.getId() == R.id.health_occupational_disease_no) {
            et1.setText("");
            et1.setEnabled(false);
            et2.setText("");
            et2.setEnabled(false);
            et3.setText("");
            et3.setEnabled(false);
            et4.setText("");
            et4.setEnabled(false);
            et5.setText("");
            et5.setEnabled(false);
            et6.setText("");
            et6.setEnabled(false);
            et7.setText("");
            et7.setEnabled(false);
        } else  if (rb.isChecked()) {
            et1.setEnabled(true);
            et1.setFocusable(true);
            et1.setFocusableInTouchMode(true);
            et1.requestFocus();
            et2.setEnabled(true);
            et2.setFocusable(true);
            et2.setFocusableInTouchMode(true);
            et2.requestFocus();
            et3.setEnabled(true);
            et3.setFocusable(true);
            et3.setFocusableInTouchMode(true);
            et3.requestFocus();
            et4.setEnabled(true);
            et4.setFocusable(true);
            et4.setFocusableInTouchMode(true);
            et4.requestFocus();
            et5.setEnabled(true);
            et5.setFocusable(true);
            et5.setFocusableInTouchMode(true);
            et5.requestFocus();
            et6.setEnabled(true);
            et6.setFocusable(true);
            et6.setFocusableInTouchMode(true);
            et6.requestFocus();
            et7.setEnabled(true);
            et7.setFocusable(true);
            et7.setFocusableInTouchMode(true);
            et7.requestFocus();
        }
    }

    /**
     * "齿列"按钮点击事件处理
     */
    public void onTooth_crackClick(View view) {
        CheckBox none = findViewById(R.id.health_Tooth_crack_normal);
        View[] views = getViews(findViewById(R.id.health_organ_function));
        boolean flag = false;
        for (int i = 0; i < views.length; i++) {
            if (views[i] instanceof CheckBox) {
                CheckBox cb = (CheckBox) views[i];
                if (cb.isChecked()) {
                    flag = true;
                }
                if (view.getId() == R.id.health_Tooth_crack_normal && cb.getId() != R.id.health_Tooth_crack_normal) {
                    if (none.isChecked()) {
                        cb.setChecked(false);
                    }
                } else if (view.getId() != R.id.health_Tooth_crack_normal) {
                    if (cb.isChecked()) {
                        none.setChecked(false);
                    }
                }
            }
        }
        if (flag != true) {
            none.setChecked(true);
        }
    }
    /*public void (View view) {
        View[] views = getViews(findViewById(R.id.health_Tooth_crack));
        CheckBox none = findViewById(R.id.health_Tooth_crack_normal);
        boolean flag = false;
        for (int i = 0; i < views.length; i++) {
            if (views[i] instanceof CheckBox) {
                CheckBox cb = (CheckBox) views[i];
                if (cb.isChecked()) {
                    flag = true;
                }
                if (view == none) {
                    if (none.isChecked() && cb != none) {
                        cb.setChecked(false);
                    }
                } else {
                    CheckBox v = (CheckBox) view;
                    if (v.isChecked()) {
                        none.setChecked(false);
                    }
                }
            }
        }
        if (flag != true) {
            none.setChecked(true);
        }
    }*/
    /**
     * "眼底"按钮点击事件处理
     */
    public void changeFundusEnableEdit(View view) {
        EditText ed = findViewById(R.id.health_fundus_other);
        RadioButton rb = (RadioButton) view;
        if (view.getId() == R.id.health_fundus_normal) {
            ed.setText("");
            ed.setEnabled(false);
        } else if (rb.isChecked()) {
            ed.setEnabled(true);
            ed.setFocusable(true);
            ed.setFocusableInTouchMode(true);
            ed.requestFocus();
        }
    }
    /**
     * "皮肤"按钮点击事件处理
     */
    public void changeThe_skinEnableEdit(View view) {
        EditText ed = findViewById(R.id.health_The_skin_other_text);
        RadioButton rb = (RadioButton) view;
        if (view.getId() == R.id.health_The_skin_other) {
            ed.setEnabled(true);
            ed.setFocusable(true);
            ed.setFocusableInTouchMode(true);
            ed.requestFocus();

        } else if (rb.isChecked()) {
            ed.setText("");
            ed.setEnabled(false);
        }
    }
    /**
     * "巩膜"按钮点击事件处理
     */
    public void changeScleraEnableEdit(View view) {
        EditText ed = findViewById(R.id.health_sclera_other_text);
        RadioButton rb = (RadioButton) view;
        if (view.getId() == R.id.health_sclera_other) {
            ed.setEnabled(true);
            ed.setFocusable(true);
            ed.setFocusableInTouchMode(true);
            ed.requestFocus();

        } else if (rb.isChecked()) {
            ed.setText("");
            ed.setEnabled(false);
        }
    }
    /**
     * "淋巴结"按钮点击事件处理
     */
    public void changeLymph_nodeEnableEdit(View view) {
        EditText ed = findViewById(R.id.health_Lymph_node_other_text);
        RadioButton rb = (RadioButton) view;
        if (view.getId() == R.id.health_Lymph_node_other) {
            ed.setEnabled(true);
            ed.setFocusable(true);
            ed.setFocusableInTouchMode(true);
            ed.requestFocus();
        } else if (rb.isChecked()) {
            ed.setText("");
            ed.setEnabled(false);
        }
    }
    /**
     * "罗音"按钮点击事件处理
     */
    public void changeRaleEnableEdit(View view) {
        EditText ed = findViewById(R.id.health_rale_other_text);
        RadioButton rb = (RadioButton) view;
        if (view.getId() == R.id.health_rale_other) {
            ed.setEnabled(true);
            ed.setFocusable(true);
            ed.setFocusableInTouchMode(true);
            ed.requestFocus();
        } else if (rb.isChecked()) {
            ed.setText("");
            ed.setEnabled(false);
        }
    }
    //肛门指诊断点击事件
    public void NationalEnableEdit_1(View view) {
        EditText ed = findViewById(R.id.health_dre_other_text);
        RadioButton rb = (RadioButton) view;
        if (view.getId() == R.id.health_dre_5) {
            ed.setEnabled(true);
            ed.setFocusable(true);
            ed.setFocusableInTouchMode(true);
            ed.requestFocus();
        } else if (rb.isChecked()) {
            ed.setText("");
            ed.setEnabled(false);
        }
    }

    /**
     * 乳腺按钮点击事件
     */
    public void onFamilialDiseaseChildrenClick(View view) {
        CheckBox none = findViewById(R.id.health_breast_none);
        CheckBox other = findViewById(R.id.health_allergy_other);
        EditText otherText = findViewById(R.id.health_allergy_other_text);
        View[] views = getViews(findViewById(R.id.health_breast));
        boolean flag = false;
        for (int i = 0; i < views.length; i++) {
            if (views[i] instanceof CheckBox) {
                CheckBox cb = (CheckBox) views[i];
                if (cb.isChecked()) {
                    flag = true;
                }
                if (view.getId() == R.id.health_breast_none && cb.getId() != R.id.health_breast_none) {
                    if (none.isChecked()) {
                        cb.setChecked(false);
                        otherText.setText("");
                        otherText.setEnabled(false);
                    }
                } else if (view.getId() != R.id.health_breast_none) {
                    if (cb.isChecked()) {
                        none.setChecked(false);
                    }
                }
            }
        }
        if (flag != true) {
            none.setChecked(true);
        }
        if (other.isChecked()) {
            otherText.setEnabled(true);
            otherText.setFocusable(true);
            otherText.setFocusableInTouchMode(true);
            otherText.requestFocus();
        } else {
            otherText.setText("");
            otherText.setEnabled(false);
        }
    }

    /**
     * 脑血管按钮点击事件
     */
    public void onAllergyClick(View view) {
        CheckBox none = findViewById(R.id.health_none1);
        CheckBox other = findViewById(R.id.health_other1);
        EditText otherText = findViewById(R.id.health_other_text1);
        View[] views = getViews(findViewById(R.id.health_cerebrovasculardisease));
        boolean flag = false;
        for (int i = 0; i < views.length; i++) {
            if (views[i] instanceof CheckBox) {
                CheckBox cb = (CheckBox) views[i];
                if (cb.isChecked()) {
                    flag = true;
                }
                if (view.getId() == R.id.health_none1 && cb.getId() != R.id.health_none1) {
                    if (none.isChecked()) {
                        cb.setChecked(false);
                        otherText.setText("");
                        otherText.setEnabled(false);
                    }
                } else if (view.getId() != R.id.health_none1) {
                    if (cb.isChecked()) {
                        none.setChecked(false);
                    }
                }
            }
        }
        if (flag != true) {
            none.setChecked(true);
        }
        if (other.isChecked()) {
            otherText.setEnabled(true);
            otherText.setFocusable(true);
            otherText.setFocusableInTouchMode(true);
            otherText.requestFocus();
        } else {
            otherText.setText("");
            otherText.setEnabled(false);
        }
    }

    /**
     * 肾脏按钮点击事件
     */
    public void onAllergyClick1(View view) {
        CheckBox none = findViewById(R.id.health_none2);
        CheckBox other = findViewById(R.id.health_other2);
        EditText otherText = findViewById(R.id.health_other_text2);
        View[] views = getViews(findViewById(R.id.health_kidneydisease));
        boolean flag = false;
        for (int i = 0; i < views.length; i++) {
            if (views[i] instanceof CheckBox) {
                CheckBox cb = (CheckBox) views[i];
                if (cb.isChecked()) {
                    flag = true;
                }
                if (view.getId() == R.id.health_none2 && cb.getId() != R.id.health_none2) {
                    if (none.isChecked()) {
                        cb.setChecked(false);
                        otherText.setText("");
                        otherText.setEnabled(false);
                    }
                } else if (view.getId() != R.id.health_none2) {
                    if (cb.isChecked()) {
                        none.setChecked(false);
                    }
                }
            }
        }
        if (flag != true) {
            none.setChecked(true);
        }
        if (other.isChecked()) {
            otherText.setEnabled(true);
            otherText.setFocusable(true);
            otherText.setFocusableInTouchMode(true);
            otherText.requestFocus();
        } else {
            otherText.setText("");
            otherText.setEnabled(false);
        }
    }
    /**
     * 心脏按钮点击事件
     */
    public void onAllergyClick2(View view) {
        CheckBox none = findViewById(R.id.health_none3);
        CheckBox other = findViewById(R.id.health_other3);
        EditText otherText = findViewById(R.id.health_other_text3);
        View[] views = getViews(findViewById(R.id.health_heartdisease));
        boolean flag = false;
        for (int i = 0; i < views.length; i++) {
            if (views[i] instanceof CheckBox) {
                CheckBox cb = (CheckBox) views[i];
                if (cb.isChecked()) {
                    flag = true;
                }
                if (view.getId() == R.id.health_none3 && cb.getId() != R.id.health_none3) {
                    if (none.isChecked()) {
                        cb.setChecked(false);
                        otherText.setText("");
                        otherText.setEnabled(false);
                    }
                } else if (view.getId() != R.id.health_none3) {
                    if (cb.isChecked()) {
                        none.setChecked(false);
                    }
                }
            }
        }
        if (flag != true) {
            none.setChecked(true);
        }
        if (other.isChecked()) {
            otherText.setEnabled(true);
            otherText.setFocusable(true);
            otherText.setFocusableInTouchMode(true);
            otherText.requestFocus();
        } else {
            otherText.setText("");
            otherText.setEnabled(false);
        }
    }
    /**
     * 血管按钮点击事件
     */
    public void onAllergyClick3(View view) {
        CheckBox none = findViewById(R.id.health_none4);
        CheckBox other = findViewById(R.id.health_other4);
        EditText otherText = findViewById(R.id.health_other_text4);
        View[] views = getViews(findViewById(R.id.health_vasculardisease));
        boolean flag = false;
        for (int i = 0; i < views.length; i++) {
            if (views[i] instanceof CheckBox) {
                CheckBox cb = (CheckBox) views[i];
                if (cb.isChecked()) {
                    flag = true;
                }
                if (view.getId() == R.id.health_none4 && cb.getId() != R.id.health_none4) {
                    if (none.isChecked()) {
                        cb.setChecked(false);
                        otherText.setText("");
                        otherText.setEnabled(false);
                    }
                } else if (view.getId() != R.id.health_none4) {
                    if (cb.isChecked()) {
                        none.setChecked(false);
                    }
                }
            }
        }
        if (flag != true) {
            none.setChecked(true);
        }
        if (other.isChecked()) {
            otherText.setEnabled(true);
            otherText.setFocusable(true);
            otherText.setFocusableInTouchMode(true);
            otherText.requestFocus();
        } else {
            otherText.setText("");
            otherText.setEnabled(false);
        }
    }
    /**
     * 眼部按钮点击事件
     */
    public void onAllergyClick4(View view) {
        CheckBox none = findViewById(R.id.health_none5);
        CheckBox other = findViewById(R.id.health_other5);
        EditText otherText = findViewById(R.id.health_other_text5);
        View[] views = getViews(findViewById(R.id.health_eyedisease));
        boolean flag = false;
        for (int i = 0; i < views.length; i++) {
            if (views[i] instanceof CheckBox) {
                CheckBox cb = (CheckBox) views[i];
                if (cb.isChecked()) {
                    flag = true;
                }
                if (view.getId() == R.id.health_none5 && cb.getId() != R.id.health_none5) {
                    if (none.isChecked()) {
                        cb.setChecked(false);
                        otherText.setText("");
                        otherText.setEnabled(false);
                    }
                } else if (view.getId() != R.id.health_none5) {
                    if (cb.isChecked()) {
                        none.setChecked(false);
                    }
                }
            }
        }
        if (flag != true) {
            none.setChecked(true);
        }
        if (other.isChecked()) {
            otherText.setEnabled(true);
            otherText.setFocusable(true);
            otherText.setFocusableInTouchMode(true);
            otherText.requestFocus();
        } else {
            otherText.setText("");
            otherText.setEnabled(false);
        }
    }



    /**
     * "健康评价"按钮点击事件处理
     */
    public void healthAssessmentClick(View view) {
        EditText ed1 = findViewById(R.id.myhealth_Assessment_abnormal1);
        EditText ed2 = findViewById(R.id.myhealth_Assessment_abnormal2);
        EditText ed3 = findViewById(R.id.myhealth_Assessment_abnormal3);
        EditText ed4 = findViewById(R.id.myhealth_Assessment_abnormal4);
        RadioButton rb = (RadioButton) view;
        if (view.getId() == R.id.myhealth_Assessment_none) {
            ed1.setText("");
            ed1.setEnabled(false);
            ed2.setText("");
            ed2.setEnabled(false);
            ed3.setText("");
            ed3.setEnabled(false);
            ed4.setText("");
            ed4.setEnabled(false);
        } else if (rb.isChecked()) {
            ed1.setEnabled(true);
            ed1.setFocusable(true);
            ed1.setFocusableInTouchMode(true);
            ed1.requestFocus();
            ed2.setEnabled(true);
            ed2.setFocusable(true);
            ed2.setFocusableInTouchMode(true);
            ed2.requestFocus();
            ed3.setEnabled(true);
            ed3.setFocusable(true);
            ed3.setFocusableInTouchMode(true);
            ed3.requestFocus();
            ed4.setEnabled(true);
            ed4.setFocusable(true);
            ed4.setFocusableInTouchMode(true);
            ed4.requestFocus();
        }
    }

    /**
     * 危险因素控制按钮点击事件
     */
    public void onRiskFactorControlClick(View view) {
       // CheckBox cb=(CheckBox)view;
        CheckBox jiantizhong = findViewById(R.id.myhealth_Risk_weightReduction);
        EditText et1 = findViewById(R.id.myhealth_Risk_weightReduction_text);
        CheckBox other = findViewById(R.id.myhealth_Risk_other);
        EditText et2 = findViewById(R.id.myhealth_Risk_other_text);
        if (jiantizhong.isChecked()) {
            et1.setEnabled(true);
            et1.setFocusable(true);
            et1.setFocusableInTouchMode(true);
            et1.requestFocus();
        }
        if(other.isChecked()){
            et2.setEnabled(true);
            et2.setFocusable(true);
            et2.setFocusableInTouchMode(true);
            et2.requestFocus();
        }
      /*  else {
            et1.setText("");
            et1.setEnabled(false);
            et2.setText("");
            et2.setEnabled(false);
        }*/
    }

    /**
     * 获取子视图
     */
    private View[] views;

    private View[] getViews(View view) {
        views = new View[0];
        parseView(view);
        return views;
    }

    private void parseView(View view) {
        if (view instanceof ViewGroup) {
            ViewGroup vg = (ViewGroup) view;
            for (int i = 0; i < vg.getChildCount(); i++) {
                View v = vg.getChildAt(i);
                parseView(v);
            }
        } else {
            views = Arrays.copyOf(views, views.length + 1);
            views[views.length - 1] = view;
        }
    }

    /**
     * 提交数据
     */
    public void onClickSubmit(View view) {
//        if (checkBasicInfoIsError()) {
//            return;
//        }
        int count = expandableListView.getExpandableListAdapter().getGroupCount();
        for (int i = 0; i < count; i++) {
            expandableListView.collapseGroup(i);
        }
        int ysid= (int) SpUtils.get(HealthCheckArchivesActivity.this,"ysid",0);
        String token = (String) SpUtils.get(HealthCheckArchivesActivity.this,"token", "");
        int mark= (int) SpUtils.get(HealthCheckArchivesActivity.this,"mark",0);
        //Map<String, Object> params = getParams();
        values.put("token",token);
        values.put("mark",mark);
        values.put("jmId", jmid);
        //values.put("tjbh",tjbh);
        values.put("userId",ysid);
        String uri = Constant.baseurl + "online/tj/addJKTJ";
        JSONObject jsonObject = new JSONObject(values);
       // OkGo.getInstance().init(getApplication());
        MyLogger.i(jsonObject.toString());
        OkGo.<String>post(uri)
                .upJson((new JSONObject(values)).toString())
                .execute(new StringCallback() {
                    @Override
                    public void onSuccess(Response<String> response) {
                        String body = response.body();
                        Gson gson = new Gson();
                        DataBean dataBean = gson.fromJson(body, DataBean.class);

                        MyLogger.i(body);
                        if (dataBean.getCode() ==0){
                            Toast.makeText(getApplicationContext(), "信息添加成功！", Toast.LENGTH_LONG).show();
                            finish();
                        }else {
                            Toast.makeText(getApplicationContext(), dataBean.getMsg(), Toast.LENGTH_LONG).show();

                        }
                    }

                    @Override
                    public void onError(Response<String> response) {
                        Toast.makeText(getApplicationContext(), "服务器暂时无法访问，稍后再试！", Toast.LENGTH_LONG).show();
                    }
                });
    }


}
